<%-- 
    Document   : monitor
    Created on : Dec 27, 2013, 1:51:52 PM
    Author     : Nigga
--%>

<%@page import="javax.jms.MessageConsumer"%>
<%@page import="java.util.Enumeration"%>
<%@page import="javax.jms.QueueBrowser"%>
<%@page import="javax.jms.TextMessage"%>
<%@page import="javax.jms.QueueReceiver"%>
<%@page import="javax.jms.Session"%>
<%@page import="javax.jms.QueueSession"%>
<%@page import="javax.jms.QueueConnection"%>
<%@page import="javax.jms.QueueConnectionFactory"%>
<%@page import="javax.jms.Queue"%>
<%@page import="javax.naming.InitialContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> Page</title>
    </head>
    <body>

        <%
            InitialContext ic = new InitialContext();

            QueueConnectionFactory queueConnectionFactory
                    = (QueueConnectionFactory) ic.lookup("jms/__defaultConnectionFactory");
            QueueConnection con = queueConnectionFactory.createQueueConnection();
            Queue queue = (Queue) ic.lookup("jms/QueueSample");
            QueueSession qs = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageConsumer reciever = qs.createReceiver(queue);
            TextMessage message = (TextMessage)reciever.receiveNoWait();
            message.getText();
        %>

    </body>
</html>
